﻿using SqlSugar;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace NbMeterServices.Entity
{
    /// <summary>
    /// 水表账号
    /// </summary>
    [SugarTable("MR_MeterAccount", "水表账号")]
    public class MrMeterAccount
    {
        /// <summary>
        /// 雪花Id
        /// </summary>
        [SugarColumn(ColumnName = "Id", ColumnDescription = "主键Id", IsPrimaryKey = true, IsIdentity = false)]
        public long Id { get; set; }

        /// <summary>
        /// 付款方式
        /// </summary>
        [SugarColumn(ColumnName = "PaymentType", ColumnDescription = "付款方式", Length = 32)]
        public string? PaymentType { get; set; }

        /// <summary>
        /// 余额
        /// </summary>
        [SugarColumn(ColumnName = "Balance", ColumnDescription = "余额", Length = 32)]
        public decimal? Balance { get; set; }


        /// <summary>
        /// 余额
        /// </summary>
        [SugarColumn(ColumnName = "EnabledDate", ColumnDescription = "开户日期", Length = 32)]
        public DateTime? EnabledDate { get; set; }

        ///// <summary>
        ///// 限额1
        ///// </summary>
        //[Required]
        //[SugarColumn(ColumnName = "Limit1", ColumnDescription = "限额1", Length = 18, DecimalDigits = 2)]
        //public decimal? Limit1 { get; set; }

        ///// <summary>
        ///// 限额1
        ///// </summary>
        //[SugarColumn(ColumnName = "Limit2", ColumnDescription = "限额1", Length = 18, DecimalDigits = 2)]
        //public decimal? Limit2 { get; set; }

        /// <summary>
        /// 起始值
        /// </summary>
        [Required]
        [SugarColumn(ColumnName = "StartingValue", ColumnDescription = "起始值", Length = 18, DecimalDigits = 3)]
        public decimal StartingValue { get; set; }

        /// <summary>
        /// 计费方式
        /// </summary>
        [Required]
        [SugarColumn(ColumnName = "BillingMethod", ColumnDescription = "计费方式")]
        public long BillingMethod { get; set; }

        /// <summary>
        /// 余额计算值
        /// </summary>
        [Required]
        [SugarColumn(ColumnName = "BalanceCalc", ColumnDescription = "余额计算值", Length = 18, DecimalDigits = 2)]
        public decimal BalanceCalc { get; set; }

        /// <summary>
        /// 备注信息
        /// </summary>
        [SugarColumn(ColumnName = "Memo", ColumnDescription = "备注信息", Length = 32)]
        public string? Memo { get; set; }

        /// <summary>
        /// 租户Id
        /// </summary>
        [SugarColumn(ColumnName = "TenantId", ColumnDescription = "租户Id")]
        public long? TenantId { get; set; }

        /// <summary>
        /// 所属ID
        /// </summary>
        [Required]
        [SugarColumn(ColumnName = "OwnerId", ColumnDescription = "所属ID")]
        public long OwnerId { get; set; }

        /// <summary>
        /// 软删除
        /// </summary>
        [SugarColumn(ColumnDescription = "软删除")]
        public virtual bool IsDelete { get; set; } = false;

        /// <summary>
        /// 仪表Id
        /// </summary>
        [SugarColumn(ColumnDescription = "仪表ID")]
        public long? MeterId { get; set; }

        /// <summary>
        /// 本月用水量
        /// </summary>
        [SugarColumn(ColumnDescription = "本月用水量")]
        public decimal? MonthWaterUsed { get; set; }
        
        /// <summary>
        /// 事件配置
        /// </summary>
        [SugarColumn(ColumnDescription = "事件配置", IsOnlyIgnoreUpdate = true)]
        public string? EventConfig { get; set; }

        /// <summary>
        /// 可用水量
        /// </summary>
        [Required]
        [SugarColumn(ColumnName = "WaterRemain", ColumnDescription = "可用水量", Length = 18, DecimalDigits = 3)]
        public decimal? WaterRemain { get; set; }
    }

}
